﻿-- By Lun Au (2004-12-03)
-- Description: Requested by Jerry
INSERT INTO SYS_PARAMETER VALUES (6055,'dms.max_upload_filename_length', 80, 'I', 'Used to control the file name length.', 'A', 0, 0,'2000-01-01 00:00:00', 0, '2000-01-01 00:00:00');

-- By Lun Au (2004-12-03)
-- Description:	For auto priority escalation
ALTER TABLE WORKFLOW_STEP ADD 	ALLOW_ASSIGN_PRIORITY char(1) NULL;

ALTER TABLE WORKFLOW_STEP ADD CONSTRAINT DF_WORKFLOW_STEP_ALLOW_ASSIGN_PRIORITY DEFAULT 'N' FOR ALLOW_ASSIGN_PRIORITY;

ALTER TABLE WORKFLOW_PROGRESS ADD  PROGRESS_PRIORITY char(1) NULL;


CREATE TABLE MTM_WF_STEP_PRIORITY_RULE (
  ID int NOT NULL,
  WORKFLOW_STEP_ID int NOT NULL,
  ESCALATE_TRIGGER char(1),
  ESCALATE_AT_FIELD int,
  ESCALATE_AT_AMT int,
  ESCALATE_LEVEL int,
  ESCALATE_ACK_METHOD varchar(3),
  RECORD_STATUS char(1) NOT NULL,
  UPDATE_COUNT int NOT NULL,
  CREATOR_ID int NOT NULL,
  CREATE_DATE datetime NOT NULL,
  UPDATER_ID int NOT NULL,
  UPDATE_DATE datetime NOT NULL,
  PRIMARY KEY  (ID)
);


CREATE TABLE MTM_WF_PROGRESS_PRIORITY_RULE (
  ID int NOT NULL,
  WORKFLOW_PROGRESS_ID int NOT NULL,
  ESCALATE_TRIGGER char(1),
  ESCALATE_AT_FIELD int,
  ESCALATE_AT_AMT int,
  ESCALATE_LEVEL int,
  ESCALATE_ACK_METHOD varchar(3),
  RECORD_STATUS char(1) NOT NULL,
  UPDATE_COUNT int NOT NULL,
  CREATOR_ID int NOT NULL,
  CREATE_DATE datetime NOT NULL,
  UPDATER_ID int NOT NULL,
  UPDATE_DATE datetime NOT NULL,
  PRIMARY KEY  (ID)
);

INSERT INTO SYS_PARAMETER VALUES (9017,'workflow.max_priority','3','I','Maximum Priority Value','A',0,0,'2000-01-01 00:00:00',0,'2000-01-01 00:00:00'); 

CREATE TABLE MTM_WF_PRIORITY_ESCALATE_LOG (
  ID int NOT NULL,
  WORKFLOW_PROGRESS_ID int NOT NULL,
  ESCALATE_TYPE char(1),
  ESCALATE_RULE_ID int,
  RECORD_STATUS char(1) NOT NULL,
  UPDATE_COUNT int NOT NULL,
  CREATOR_ID int NOT NULL,
  CREATE_DATE datetime NULL,
  UPDATER_ID int NOT NULL,
  UPDATE_DATE datetime NULL,
  PRIMARY KEY  (ID)
);

INSERT INTO SYS_PARAMETER VALUES (1021,'system.allow_change_preference','true','B','Allow user to change preference or not.','A',0,0,'2000-01-01 00:00:00',0,'2000-01-01 00:00:00');

CREATE TABLE MTM_WF_STEP_NOTIFY_RULE (
  ID int NOT NULL,
  WORKFLOW_STEP_ID int NOT NULL,
  NOTIFY_TRIGGER char(1) NOT NULL,
  NOTIFY_AT_FIELD int,
  NOTIFY_AT_AMT int,
  NOTIFY_ACK_METHOD varchar(3) NOT NULL,
  RECORD_STATUS char(1) NOT NULL,
  UPDATE_COUNT int NOT NULL,
  CREATOR_ID int NOT NULL,
  CREATE_DATE datetime NOT NULL,
  UPDATER_ID int NOT NULL,
  UPDATE_DATE datetime NOT NULL,
  PRIMARY KEY  (ID)
);


CREATE TABLE MTM_WF_STEP_NOTIFY_TARGET (
  ID int NOT NULL,
  NOTIFY_RULE_ID int NOT NULL,
  TARGET_TYPE char(1) NOT NULL,
  TARGET_ID int,
  RECORD_STATUS char(1) NOT NULL,
  UPDATE_COUNT int NOT NULL,
  CREATOR_ID int NOT NULL,
  CREATE_DATE datetime NOT NULL,
  UPDATER_ID int NOT NULL,
  UPDATE_DATE datetime NOT NULL,
  PRIMARY KEY  (ID)
);

CREATE TABLE DMS_PERSONAL_STORAGE_SETUP (
  ID int NOT NULL,
  MEMBER_ID int NOT NULL,
  MEMBER_TYPE char(1) NOT NULL,
  STORAGE_LIMIT float NULL,
  RECORD_STATUS char(1) NOT NULL,
  UPDATE_COUNT int NOT NULL,
  CREATOR_ID int NOT NULL,
  CREATE_DATE datetime NOT NULL,
  UPDATER_ID int NOT NULL,
  UPDATE_DATE datetime NOT NULL,
  PRIMARY KEY  (ID)
);

-- By Lun Au (2004-12-16)
-- Description: Notification enhancement
INSERT INTO SYS_PARAMETER VALUES (9018,'workflow.mail_before_due_notification_subject', 'PARA Flow Task Before Due Date Notification', 'S', 'Email Subject for Task Before Due Date Notification.', 'A', 0, 0, '2000-01-01 00:00:00', 0, '2000-01-01 00:00:00');
INSERT INTO SYS_PARAMETER VALUES (9019,'workflow.mail_pending_for_notification_subject', 'PARA Flow Task Pending Notification', 'S', 'Email Subject for Task Pending Notification.', 'A', 0, 0, '2000-01-01 00:00:00', 0, '2000-01-01 00:00:00');
INSERT INTO SYS_PARAMETER VALUES (9020,'workflow.mail_in_progressing_notification_subject', 'PARA Flow Task In Progress Notification', 'S', 'Email Subject for Task In Progress Notification.', 'A', 0, 0, '2000-01-01 00:00:00', 0, '2000-01-01 00:00:00');

-- By Lun Au (2004-12-16)
-- Description: Notification enhancement
DROP INDEX UPDATE_ALERT_TYPE .ACTION_TYPE;
ALTER TABLE UPDATE_ALERT_TYPE ALTER COLUMN ACTION_TYPE varchar(2) NULL;
CREATE NONCLUSTERED INDEX ACTION_TYPE ON  UPDATE_ALERT_TYPE  (ACTION_TYPE);

-- By Lun Au (2004-12-16)
-- Description: Request by Scott
BEGIN TRANSACTION
ALTER TABLE dbo.FORM_ELEMENT ADD
	IS_LABEL char(1) NOT NULL CONSTRAINT DF_FORM_ELEMENT_IS_LABEL DEFAULT 'N'
GO
COMMIT;

-- By Lun Au (2004-12-20)
-- Description: Form value driven task
ALTER TABLE WORKFLOW_STEP_FORM_EQUAT ADD ROUTE_SEQ int NOT NULL;
ALTER TABLE WORKFLOW_STEP_FORM_EQUAT ADD ROUTE_NAME nvarchar(100) NOT NULL;

ALTER TABLE dbo.WORKFLOW_STEP_FORM_EQUAT ADD
	DEFAULT_FLAG char(1) NOT NULL CONSTRAINT DF_WORKFLOW_STEP_FORM_EQUAT_DEFAULT_FLAG DEFAULT 'N';


-- By Lun Au (2004-12-21)
-- Description: Form value driven task
ALTER TABLE WORKFLOW_STEP_FORM_EQUAT DROP FORM_RECORD_ID;



-- By Lun Au (2004-12-21)
-- Description: Add MTM_WF_PROGRESS_WF_PROGRESS table
IF EXISTS(SELECT         *
FROM             sysobjects
WHERE         name = 'MTM_WF_PROGRESS_WF_PROGRESS')  Drop table MTM_WF_PROGRESS_WF_PROGRESS;



CREATE TABLE MTM_WF_PROGRESS_WF_PROGRESS (
  ID int NOT NULL,
  PARENT_PROGRESS_ID int NOT NULL,
  CHILD_PROGRESS_ID int NOT NULL,
  CHILD_CREATE_TYPE char(1) default 'N',
  RECORD_STATUS char(1) NOT NULL,
  UPDATE_COUNT int NOT NULL,
  CREATOR_ID int NOT NULL,
  CREATE_DATE datetime NOT NULL,
  UPDATER_ID int NOT NULL,
  UPDATE_DATE datetime NOT NULL,
  PRIMARY KEY  (ID)
);

CREATE TABLE TMP_MTM_WF_PROGRESS_WF_PROGRESS (
  ID int NOT NULL,
  PARENT_PROGRESS_ID int NOT NULL,
  CHILD_PROGRESS_ID int NOT NULL,
  CHILD_CREATE_TYPE char(1) default 'N',
  RECORD_STATUS char(1) NOT NULL,
  UPDATE_COUNT int NOT NULL,
  CREATOR_ID int NOT NULL,
  CREATE_DATE datetime NOT NULL,
  UPDATER_ID int NOT NULL,
  UPDATE_DATE datetime NOT NULL,
  PRIMARY KEY  (ID)
);


INSERT INTO TMP_MTM_WF_PROGRESS_WF_PROGRESS
(PARENT_PROGRESS_ID, CHILD_PROGRESS_ID, CHILD_CREATE_TYPE, RECORD_STATUS, UPDATE_COUNT , CREATOR_ID ,  CREATE_DATE ,  UPDATER_ID ,  UPDATE_DATE)
SELECT P1.ID, P2.ID,'N',P2.RECORD_STATUS,0,P2.CREATOR_ID,P2.CREATE_DATE,P2.UPDATER_ID,P2.UPDATE_DATE
FROM WORKFLOW_PROGRESS P1, WORKFLOW_STEP S1, MTM_WF_STEP_WF_STEP SS, WORKFLOW_STEP S2, WORKFLOW_PROGRESS P2
WHERE S1.ID=SS.PARENT_STEP_ID
AND S1.ID=P1.WORKFLOW_STEP_ID
AND S2.ID=SS.CHILD_STEP_ID
AND S2.ID=P2.WORKFLOW_STEP_ID
AND P1.TRACK_ID=P2.TRACK_ID
ORDER BY P2.ID;

INSERT INTO MTM_WF_PROGRESS_WF_PROGRESS SELECT * FROM TMP_MTM_WF_PROGRESS_WF_PROGRESS;
DELETE FROM SYS_TABLE_KEY WHERE TABLE_NAME='MTM_WF_PROGRESS_WF_PROGRESS';
INSERT INTO SYS_TABLE_KEY SELECT 'MTM_WF_PROGRESS_WF_PROGRESS', MAX(ID) FROM MTM_WF_PROGRESS_WF_PROGRESS;

DROP TABLE TMP_MTM_WF_PROGRESS_WF_PROGRESS;

-- By Lun Au (2004-12-24)
-- Description: Save delegated user information
ALTER TABLE MTM_WF_PROGRESS_USER_RECORD ADD DELEGATE_USER_RECORD_ID int;

-- By Lun Au (2004-12-28)
-- Description: Requested by Charlie
ALTER TABLE STAFF_RECORD ALTER COLUMN STAFF_CODE nvarchar(200) NOT NULL;

INSERT INTO SYS_PARAMETER VALUES (11000, 'ldap.host', 'ldap://localhost:389', 'S', 'ldap host url', 'A', 0, 0, '2000-01-01 00:00:00', 0, '2000-01-01 00:00:00');
INSERT INTO SYS_PARAMETER VALUES (11001, 'ldap.mgrDN', 'cn=root, dc=example, dc=com', 'S', 'ldap login user', 'A', 0, 0, '2000-01-01 00:00:00', 0, '2000-01-01 00:00:00');
INSERT INTO SYS_PARAMETER VALUES (11002, 'ldap.mgrPW', '', 'S', 'ldap login password', 'A', 0, 0, '2000-01-01 00:00:00', 0, '2000-01-01 00:00:00');
INSERT INTO SYS_PARAMETER VALUES (11003, 'ldap.searchBase', 'dc=example,dc=com', 'S', 'ldap search scope', 'A', 0, 0, '2000-01-01 00:00:00', 0, '2000-01-01 00:00:00');
INSERT INTO SYS_PARAMETER VALUES (11004, 'ldap.filter', 'dc=example,dc=com', 'S', 'filter of ldap search', 'A', 0, 0, '2000-01-01 00:00:00', 0, '2000-01-01 00:00:00');
INSERT INTO SYS_PARAMETER VALUES (11100, 'ldap.staff.code', 'dn', 'S', 'staff_code/ldap mapping', 'A', 0, 0, '2000-01-01 00:00:00', 0, '2000-01-01 00:00:00');
INSERT INTO SYS_PARAMETER VALUES (11101, 'ldap.user.firstName', '', 'S', 'user_firstName/ldap mapping', 'A', 0, 0, '2000-01-01 00:00:00', 0, '2000-01-01 00:00:00');
INSERT INTO SYS_PARAMETER VALUES (11102, 'ldap.user.lastName', '', 'S', 'user_lastName/ldap mapping', 'A', 0, 0, '2000-01-01 00:00:00', 0, '2000-01-01 00:00:00');
INSERT INTO SYS_PARAMETER VALUES (11103, 'ldap.user.fullName', '', 'S', 'user_fullName/ldap mapping', 'A', 0, 0, '2000-01-01 00:00:00', 0, '2000-01-01 00:00:00');
INSERT INTO SYS_PARAMETER VALUES (11104, 'ldap.user.email', '', 'S', 'user_email/ldap mapping', 'A', 0, 0, '2000-01-01 00:00:00', 0, '2000-01-01 00:00:00');
INSERT INTO SYS_PARAMETER VALUES (11105, 'ldap.user.loginName', '', 'S', 'user_loginName/ldap mapping', 'A', 0, 0, '2000-01-01 00:00:00', 0, '2000-01-01 00:00:00');
INSERT INTO SYS_PARAMETER VALUES (11106, 'ldap.user.loginPassword', '', 'S', 'user_loginPassword/ldap mapping', 'A', 0, 0, '2000-01-01 00:00:00', 0, '2000-01-01 00:00:00');
INSERT INTO SYS_PARAMETER VALUES (11107, 'ldap.user.max_attempt', 'dn', 'S', 'user_max_attempt/ldap mapping', 'A', 0, 0, '2000-01-01 00:00:00', 0, '2000-01-01 00:00:00');
INSERT INTO SYS_PARAMETER VALUES (11108, 'ldap.user.expiry_day', '', 'S', 'user_expiry_day/ldap mapping', 'A', 0, 0, '2000-01-01 00:00:00', 0, '2000-01-01 00:00:00');
INSERT INTO SYS_PARAMETER VALUES (11109, 'ldap.user.status', '', 'S', 'user_status/ldap mapping', 'A', 0, 0, '2000-01-01 00:00:00', 0, '2000-01-01 00:00:00');
INSERT INTO SYS_PARAMETER VALUES (11110, 'ldap.user.preference', '', 'S', 'user_preference/ldap mapping', 'A', 0, 0, '2000-01-01 00:00:00', 0, '2000-01-01 00:00:00');
INSERT INTO SYS_PARAMETER VALUES (11111, 'ldap.user.language', '', 'S', 'user_language/ldap mapping', 'A', 0, 0, '2000-01-01 00:00:00', 0, '2000-01-01 00:00:00');
INSERT INTO SYS_PARAMETER VALUES (11112, 'system.authentication.method', '', 'S', 'paradm login method', 'A', 0, 0, '2000-01-01 00:00:00', 0, '2000-01-01 00:00:00');


UPDATE SYS_FUNCTION SET LINK_URL='/user/SelectSource.do' WHERE ID=1007;


INSERT INTO SYS_PARAMETER VALUES (6056,'dms.group_server_address', '', 'S', 'related server ip adress with semi colon as delimit', 'A', 0, 0, '2000-01-01 00:00:00', 0, '2000-01-01 00:00:00');

CREATE TABLE WORKFLOW_SCHEDULE_TRIGGERS (
  ID int NOT NULL,
  WORKFLOW_RECORD_ID int NOT NULL,
  CRITERIA_EXPRESSION nvarchar(255) default NULL,
  CRITERIA_CONFIG nvarchar(255) default NULL,
  SCHEDULE_NAME nvarchar(255) default NULL,
  SCHEDULE_START datetime NOT NULL ,
  SCHEDULE_END datetime,
  SCHEDULE_TYPE int NOT NULL ,
  SCHEDULE_STYLE int,
  INCLUDE_LIST nvarchar(255) ,
  EXTRA_PARAMETER_1 nvarchar(255) ,
  EXTRA_PARAMETER_2 nvarchar(255) ,
  RECURR_RUN_CNT int,
  RECURR_MAX_RUN int,
  RECURR_EXPRESSION varchar(80),
  STATUS char(1) NOT NULL,
  PREVIOUS_FIRE_TIME datetime ,
  NEXT_FIRE_TIME datetime,
  RECORD_STATUS char(1) NOT NULL,
  UPDATE_COUNT int NOT NULL,
  CREATOR_ID int NOT NULL,
  CREATE_DATE datetime NOT NULL,
  UPDATER_ID int NOT NULL,
  UPDATE_DATE datetime NOT NULL,
  PRIMARY KEY  (ID)
);

CREATE TABLE WORKFLOW_TRIGGERS_LOG (
  ID int NOT NULL,
  WORKFLOW_TRIGGER_ID int NOT NULL,
  WORKFLOW_TRACK_ID int NOT NULL,
  RECORD_STATUS char(1) NOT NULL,
  UPDATE_COUNT int NOT NULL,
  CREATOR_ID int NOT NULL,
  CREATE_DATE datetime NOT NULL,
  UPDATER_ID int NOT NULL,
  UPDATE_DATE datetime NOT NULL,
  PRIMARY KEY  (ID)
);

INSERT INTO SYS_FUNCTION VALUES (8007,'WFM_SCHEDULE','Schedule',N'流程排定',N'流程排定',8000,'/workflow/ListWorkflowScheduleGroup.do',5,'S','RIED','A',0,'2000-01-01 00:00:00',0,'2000-01-01 00:00:00');



-- By Lun Au (2005-01-03)
-- Description: Data migration for progress priority
UPDATE WORKFLOW_PROGRESS
SET PROGRESS_PRIORITY = (select  PRIORITY from WORKFLOW_STEP where  WORKFLOW_PROGRESS.WORKFLOW_STEP_ID= WORKFLOW_STEP.ID )
WHERE PROGRESS_PRIORITY IS NULL;


-- By Lun Au (2005-01-04)
-- Description: Workflow Interruption(rollback/revoke)
CREATE TABLE MTM_WF_TRACK_INTERRUPT_REQ (
  ID int NOT NULL,
  WORKFLOW_TRACK_ID int NOT NULL,
  TARGET_STEP_ID int NOT NULL,
  INTERRUPT_TYPE int NOT NULL,
  INTERRUPT_STATUS char(1) NULL,
  APPROVAL_TRACK_ID int,
  PARENT_CHILD_ID int,
  RECORD_STATUS char(1) NOT NULL,
  UPDATE_COUNT int NOT NULL,
  CREATOR_ID int NOT NULL,
  CREATE_DATE datetime NOT NULL,
  UPDATER_ID int NOT NULL,
  UPDATE_DATE datetime NOT NULL,
  PRIMARY KEY  (ID)
);

CREATE TABLE MTM_WF_INTERRUPT_USER_ACTOR (
  ID int NOT NULL,
  WORKFLOW_RECORD_ID int NOT NULL,
  ACTOR_TYPE char(1) NOT NULL,
  ACTOR_ID int NOT NULL,
  INTERRUPT_PRIVILEGE char(1),
  RECORD_STATUS char(1) NOT NULL,
  UPDATE_COUNT int NOT NULL,
  CREATOR_ID int NOT NULL,
  CREATE_DATE datetime NULL,
  UPDATER_ID int NOT NULL,
  UPDATE_DATE datetime NULL,
  PRIMARY KEY  (ID)
);



BEGIN TRANSACTION
ALTER TABLE dbo.WORKFLOW_RECORD ADD
	ALLOW_INTERRUPT char(1) NOT NULL CONSTRAINT DF_WORKFLOW_RECORD_ALLOW_INTERRUPT DEFAULT 'N'
GO
COMMIT;

INSERT INTO SETUP_OPTION_WORKFLOW_CATEGORY VALUES (15,'ParaFLOW Interruption Control','A',NULL,'Y','A',0,0,'2000-01-01 00:00:00',0,'2000-01-01 00:00:00');

-- By Lun Au (2005-01-05)
-- Description: Number of display for each homepage channel

INSERT INTO SYS_PARAMETER VALUES (2009,'display.channel_todo_offset','10', 'I', 'The default number of records display in homepage todo channel.', 'A', 0, 0, '2000-01-01 00:00:00', 0, '2000-01-01 00:00:00');
INSERT INTO SYS_PARAMETER VALUES (2010,'display.channel_meeting_event_offset','10', 'I', 'The default number of records display in homepage meetings and events channel.', 'A', 0, 0, '2000-01-01 00:00:00', 0, '2000-01-01 00:00:00');
INSERT INTO SYS_PARAMETER VALUES (2011,'display.channel_system_log_offset','10', 'I', 'The default number of records display in homepage message inbox channel.', 'A', 0, 0, '2000-01-01 00:00:00', 0, '2000-01-01 00:00:00');
INSERT INTO SYS_PARAMETER VALUES (2012,'display.channel_recent_access_offset','10', 'I', 'The default number of records display in homepage recent documents channel.', 'A', 0, 0, '2000-01-01 00:00:00', 0, '2000-01-01 00:00:00');
INSERT INTO SYS_PARAMETER VALUES (2013,'display.channel_workflow_task_offset','10', 'I', 'The default number of records display in homepage task inbox channel.', 'A', 0, 0, '2000-01-01 00:00:00', 0, '2000-01-01 00:00:00');
INSERT INTO SYS_PARAMETER VALUES (2014,'display.channel_workflow_track_offset','10', 'I', 'The default number of records display in homepage progress monitor channel.', 'A', 0, 0, '2000-01-01 00:00:00', 0, '2000-01-01 00:00:00');

-- By Lun Au (2005-01-06)
INSERT INTO SYS_PARAMETER VALUES (9021,'workflow.mail_priority_changed_notification_subject', 'PARA Flow Task Priority Changed Notification', 'S', 'Email Subject for Task Priority Changed Notification.', 'A', 0, 0, '2000-01-01 00:00:00', 0, '2000-01-01 00:00:00');

-- By Lun Au (2005-01-11)
-- Requested by Jenny
UPDATE SYS_FUNCTION SET STATUS = 'A' WHERE ID=4000;
UPDATE SYS_FUNCTION SET STATUS = 'A' WHERE ID=4002;
INSERT INTO SYS_FUNCTION VALUES (4003,'CON_GROUP','Contacts Group','聯繫群組','联系群组',4000,'/contact/ListContactGroup.do',2,'S','RIECD','A',0,'2000-01-01 00:00:00',0,'2000-01-01 00:00:00');

CREATE TABLE CONTACT_LIST( 
  ID int NOT NULL,
  CONTACT_LIST_NAME nvarchar(200) default '', 
  DESCRIPTION nvarchar(255) default '', 
  PUBLIC_FLAG char(1) default 'Y', 
  RECORD_STATUS char(1) NOT NULL,
  UPDATE_COUNT int NOT NULL,
  CREATOR_ID int NOT NULL,
  CREATE_DATE datetime NOT NULL,
  UPDATER_ID int NOT NULL,
  UPDATE_DATE datetime NOT NULL,
  PRIMARY KEY  (ID)
);

CREATE TABLE CONTACT_PERSON ( 
  ID int NOT NULL,
  OWNER_ID int NOT NULL, 
  FIRST_NAME nvarchar(100) default '', 
  LAST_NAME nvarchar(100) default '', 
  PHONE_NO nvarchar(30) NULL, 
  MOBILE_NO nvarchar(30) NULL, 
  FAX_NO nvarchar(30) NULL,
  EMAIL nvarchar(200) NULL,
  REMARKS nvarchar(255) NULL,
  TITLE nvarchar(150) NULL,
  DEPARTMENT nvarchar(200) NULL,
  PUBLIC_FLAG char(1) default 'Y', 
  RECORD_STATUS char(1) NOT NULL,
  UPDATE_COUNT int NOT NULL,
  CREATOR_ID int NOT NULL,
  CREATE_DATE datetime NOT NULL,
  UPDATER_ID int NOT NULL,
  UPDATE_DATE datetime NOT NULL,
  PRIMARY KEY  (ID)
);

CREATE TABLE MTM_CONTACT_LIST_OBJECT_LINK ( 
  ID int NOT NULL,
  CONTACT_LIST_ID int NOT NULL, 
  OBJECT_TYPE char(1) default '', 
  OBJECT_ID int default '0', 
  RECORD_STATUS char(1) NOT NULL,
  UPDATE_COUNT int NOT NULL,
  CREATOR_ID int NOT NULL,
  CREATE_DATE datetime NOT NULL,
  UPDATER_ID int NOT NULL,
  UPDATE_DATE datetime NOT NULL,
  PRIMARY KEY  (ID)
);

CREATE TABLE MTM_WF_PROGRESS_NOTIFY_RULE (
  ID int NOT NULL,
  WORKFLOW_PROGRESS_ID int NOT NULL,
  NOTIFY_TRIGGER char(1) NOT NULL,
  NOTIFY_AT_FIELD int,
  NOTIFY_AT_AMT int,
  NOTIFY_ACK_METHOD varchar(3) NOT NULL,
  RECORD_STATUS char(1) NOT NULL,
  UPDATE_COUNT int NOT NULL,
  CREATOR_ID int NOT NULL,
  CREATE_DATE datetime NOT NULL,
  UPDATER_ID int NOT NULL,
  UPDATE_DATE datetime NOT NULL,
  PRIMARY KEY  (ID)
);

CREATE TABLE MTM_WF_PROGRESS_NOTIFY_TARGET (
  ID int NOT NULL,
  NOTIFY_RULE_ID int NOT NULL,
  TARGET_TYPE char(1) NOT NULL,
  TARGET_ID int,
  RECORD_STATUS char(1) NOT NULL,
  UPDATE_COUNT int NOT NULL,
  CREATOR_ID int NOT NULL,
  CREATE_DATE datetime NOT NULL,
  UPDATER_ID int NOT NULL,
  UPDATE_DATE datetime NOT NULL,
  PRIMARY KEY  (ID)
);

-- By Lun Au (2005-01-14)
-- Description: New notification rule type
INSERT INTO SYS_PARAMETER VALUES (9022,'workflow.mail_check_out_by_user_notification_subject', 'PARA Flow Task Check Out By User Notification', 'S', 'Email Subject for Task Check Out By User Notification.', 'A', 0, 0, '2000-01-01 00:00:00', 0, '2000-01-01 00:00:00');
INSERT INTO SYS_PARAMETER VALUES (9023,'workflow.mail_completed_by_user_notification_subject', 'PARA Flow Task Completed By User Notification', 'S', 'Email Subject for Task Completed By User Notification.', 'A', 0, 0, '2000-01-01 00:00:00', 0, '2000-01-01 00:00:00');

-- By Lun Au (2005-01-17)
-- Description: Requested by Jenny
INSERT INTO SYS_PARAMETER VALUES (3008,'smtp.max.thread.count','0','I',NULL,'A',0,0,'2000-01-01 00:00:00',0,'2000-01-01 00:00:00');

-- By Lun Au (2005-01-17)
-- Description: Disable DMS new folder automatic task
UPDATE WORKFLOW_ACTION SET RECORD_STATUS='I' WHERE ACTION_LABEL='workflow.action.label.dms_new_folder';


























